package com.yuhs.zixing.study.multithread.mashibing.t002lock.l002;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

/**
 * Function: volatile
 * 保证可见性 禁止指令重排序
 *
 * @Author yuhongsheng
 * @Date: 2023-12-23 19:59:42
 */
@Slf4j
public class Lock002Volatile003DCL {

    private Lock002Volatile003DCL() {

    }

    private static volatile Lock002Volatile003DCL INSTANCE = null;

    public static Lock002Volatile003DCL getInstance() {

        if (null == INSTANCE) {
            synchronized (Lock002Volatile003DCL.class) {
                if (null == INSTANCE) {
                    INSTANCE = new Lock002Volatile003DCL();
                }
            }
        }
        return INSTANCE;
    }

    @SneakyThrows
    public static void main(String[] args) {
        Lock002Volatile003DCL volatile003DCL = Lock002Volatile003DCL.INSTANCE;
    }


}
